using UnityEngine;

public class GGInput : MonoBehaviour
{
	private UIInput label;

	private void Awake()
	{
		if (Application.platform == RuntimePlatform.MetroPlayerARM || Application.platform == RuntimePlatform.MetroPlayerX86 || Application.platform == RuntimePlatform.MetroPlayerX86)
		{
			label = base.gameObject.GetComponent<UIInput>();
			if (label != null)
			{
				label.enabled = false;
			}
		}
	}

	private void OnEnable()
	{
		GGKeyboardInput.onInput += OnInputMessage;
		Debug.Log("GGInput enabled");
	}

	private void OnDisable()
	{
		GGKeyboardInput.onInput -= OnInputMessage;
		Debug.Log("GGInput disabled");
	}

	private void OnDestroy()
	{
		GGKeyboardInput.onInput -= OnInputMessage;
	}

	private void OnInputMessage(string message, bool succes)
	{
		if (succes)
		{
			label.value = message;
			label.label.text = message;
		}
	}

	public void OnClick()
	{
		Debug.Log("GGInput click");
		if (!(label == null))
		{
			GGKeyboardInput.ShowInput("Input Dialog", label.label.text);
		}
	}
}
